<div id="body" class="layout">
    <div class="wrap">
        <div class="left">
            <ul class="sort-panel">
                <li class="s-text">You are here:</li>
                <li>
                    <a href="<?php echo $this->baseUrl(""); ?>">
                        <span class="first">
                            <span class="last">
                                <span class="middle">
                                    Home
                                </span>
                            </span>
                        </span>
                    </a>
                </li>
                <li>
                    <a href="<?php echo $this->baseUrl("events/sponsored"); ?>" class="current selected">
                        <span class="first">
                            <span class="last">
                                <span class="middle">
                                    Sponsored Events
                                </span>
                            </span>
                        </span>
                    </a>
                </li>
            </ul>
            <div class="cf"></div>
            <div class="page-name">
                Sponsored <strong>Events</strong>
            </div>
            <ul class="sponsored-events">
                <?php
                    if (!empty($this->alldata))
                    {
                        foreach ($this->alldata as $key => $value)
                        {
                            $event_id = $value["event_id"];
                            $enc_event_id = getEncryptedString($event_id);
                            $event_title = $value["event_title"];
                            $event_info = $value["event_info"];
//                            $event_time = date("H:i ", strtotime($value["event_time"])) . " " . TIME_ZONE;
                            $event_time = date("g:i a", strtotime($value["event_time"]));
                            $event_url = $this->baseUrl("eventdetail/$enc_event_id");

                            $event_image_array = getEventImages($event_id);
                            $remaining_spots = $value["remaining_spots"];

                            $event_date_array = json_decode($value["event_date"]);
                            $event_date = $event_date_array->day[0] . " " . date("F", strtotime($event_date_array->month[0])) . " " . $event_date_array->year[0];
                            ?>
                            <li>
                                <div class="pimg fl">
                                    <img src="<?php echo $event_image_array[0]; ?>" alt="<?php echo $event_title; ?>" />
                                </div>
                                <div class="fl content">
                                    <div class="title">
                                        <a href="<?php echo $event_url; ?>" class="p-name tlink"><?php echo $event_title; ?></a>
                                        <span class="p-cates">
                                            <span>in</span> <a href="#" class="tlink org"><?php echo $value["category_name"]; ?></a> / <a class="tlink org" href="#"><?php echo $value["subcategory_name"]; ?></a>
                                        </span>
                                        <span class="p-time"><?php echo $event_date . " / " . $event_time; ?></span>
                                        <div class="cf"></div>
                                    </div>
                                    <div class="infos">
                                        <span class="group">Group size </span><span><?php echo $value["event_group_size"]; ?></span><span> / </span>
                                        <span class="org">Available Spots  </span><span><?php echo $remaining_spots; ?></span>
                                        <span class="fr"><a href="#" class="tlink org"><?php echo ucwords($value["group_type"]); ?></a></span>
                                        <div class="cf"></div>
                                    </div>
                                    <div class="desc">
                                        <p><?php echo $event_info; ?></p>
                                    </div>
                                </div>
                            </li>
                            <?php
                        }
                    }
                    else
                    {
                        echo '<p style="padding:10px;">No sponsored events</p>';
                    }
                ?>
            </ul>
            <div class="cf"></div>
            <br /><br/>
            <?php
                echo $this->paginationControl($this->paginator, 'Sliding', 'pagination/pagination.phtml', array('type_of_data' => 'message_inbox'));
            ?>
        </div>
        <div class="right">
            <?php
                echo $this->partial("ads.phtml", array("ads_count" => "3"));
            ?>
        </div>
        <div class="cf"></div>
    </div>
</div>